//41BFC698-BDF2-58A5-8C7B-70B8E7BE9B57

package com.ruoyi.web.test;

/**
 * @Title: com.ruoyi.web.test
 * @author: Sunne
 * @date: 2024-11-20 上午11:22
 * @Description: 代码备注说明
 */
/*
引入依赖包
最低SDK版本要求：viapi20230117的SDK版本需大于等于2.0.1。
可以在此仓库地址中引用最新版本SDK：https://mvnrepository.com/artifact/com.aliyun/viapi20230117
<!-- https://mvnrepository.com/artifact/com.aliyun/viapi20230117 -->
<dependency>
      <groupId>com.aliyun</groupId>
      <artifactId>viapi20230117</artifactId>
      <version>${aliyun.viapi.version}</version>
</dependency>
*/

import com.aliyun.tea.TeaModel;
import com.aliyun.teaopenapi.models.Config;
import com.aliyun.teautil.models.RuntimeOptions;
import com.aliyun.videoenhan20200320.Client;
import com.aliyun.videoenhan20200320.models.GetAsyncJobResultRequest;
import com.aliyun.videoenhan20200320.models.GetAsyncJobResultResponse;

public class QueryAsyncJobList {
    public static Client createClient(String accessKeyId, String accessKeySecret) throws Exception {
        /*
          初始化配置对象com.aliyun.teaopenapi.models.Config
          Config对象存放 AccessKeyId、AccessKeySecret、endpoint等配置
         */
        Config config = new Config()
                .setAccessKeyId(accessKeyId)
                .setAccessKeySecret(accessKeySecret);
        // 访问的域名
        config.endpoint = "viapi.cn-shanghai.aliyuncs.com";
        return new Client(config);
    }

    public static void main(String[] args_) throws Exception {
        // 创建AccessKey ID和AccessKey Secret，请参考https://help.aliyun.com/document_detail/175144.html
        // 如果您使用的是RAM用户的AccessKey，还需要为子账号授予权限AliyunVIAPIFullAccess，请参考https://help.aliyun.com/document_detail/145025.html
        // 从环境变量读取配置的AccessKey ID和AccessKey Secret。运行代码示例前必须先配置环境变量。
        String accessKeyId = "LTAI5tLEqDgixECTnRbXzTS1";
        String accessKeySecret = "EVafnha5xj5o5wYxPxQYS3YKyLXjBg";
       Client client = QueryAsyncJobList.createClient(accessKeyId, accessKeySecret);
//        QueryAsyncJobListRequest queryAsyncJobListRequest = new QueryAsyncJobListRequest()
//                .setJobId("1299348D-DFF2-5FDA-8C9C-C2D14EBF63F2")
//                .setStartTime("2023-02-23 00:00:00")
//                .setEndTime("2023-02-23 23:00:00");
        GetAsyncJobResultRequest request = new GetAsyncJobResultRequest().setJobId("41BFC698-BDF2-58A5-8C7B-70B8E7BE9B57");
        RuntimeOptions runtime = new RuntimeOptions();
        try {
//            QueryAsyncJobListResponse queryAsyncJobListResponse = client.queryAsyncJobListWithOptions(queryAsyncJobListRequest, runtime);
            GetAsyncJobResultResponse queryAsyncJobListResponse2 = client.getAsyncJobResult(request);
            // 获取整体结果。
            // 获取单个字段。
            System.out.println(queryAsyncJobListResponse2.getBody());
        } catch (com.aliyun.tea.TeaException teaException) {
            // 获取整体报错信息。
            System.out.println(com.aliyun.teautil.Common.toJSONString(teaException));
            // 获取单个字段。
            System.out.println(teaException.getCode());
        }
    }
}
